package config

import (
	"mall/service/backend/common/i18n"
	"mall/service/backend/common/utils/captcha"

	"github.com/zeromicro/go-zero/core/stores/redis"
	"github.com/zeromicro/go-zero/rest"
	"github.com/zeromicro/go-zero/zrpc"
)

type Config struct {
	rest.RestConf

	Auth struct {
		AccessSecret string
		AccessExpire int64
	}

	Erp struct {
		AppKey      string
		Secret      string
		Url         string
		StorageCode string
		ShopNick    string
		ShopType    uint64
	}

	Captcha captcha.Conf

	Query struct {
		DefaultAmount            int64
		MaxAmount                int64
		PhotoForumId             int64
		PostForumId              int64
		ColumnForumId            int64
		DefaultForumId           int64
		LocalCacheExpireTime     int64
		ExpireTime               int
		DefaultElasticSearchHost string
		PreviewLink              string
		RevalidateLink           string
		WebSocketChatUrl         string
		GorseUrl                 string
	}

	NfsConf struct {
		SiteUrl          string `json:",env=SITE_URL"`
		ProxyUrl         string `json:",env=PROXY_URL"`
		StaticUrl        string `json:",env=STATIC_URL"`
		PathPrefix       string `json:",env=PATH_PREFIX"`
		AllowedFileExts  string `json:",default=jpg,jpeg,png,gif"`
		MaxImageSize     uint64 `json:",default=5242880,env=MAX_IMAGE_SIZE"`
		MaxVideoSize     uint64 `json:",default=1073741824,env=MAX_VIDEO_SIZE"`
		MaxAudioSize     uint64 `json:",default=33554432,env=MAX_AUDIO_SIZE"`
		MaxOtherSize     uint64 `json:",default=10485760,env=MAX_OTHER_SIZE"`
		PrivateStorePath string `json:",env=PRIVATE_PATH"`
		PublicStorePath  string `json:",env=PUBLIC_PATH"`
	}

	QiniuConf struct {
		AccessKey     string
		SecretKey     string
		Bucket        string
		Domain        string
		Region        string
		UseHTTPS      bool
		UseCdnDomains bool
	}

	WxMiniConf WxMiniConf

	BizRedis redis.RedisConf

	CasbinConf   CasbinConf
	DatabaseConf DatabaseConf
	I18nConf     i18n.Conf
	ProjectConf  ProjectConf
	CROSConf     CROSConf

	AttachmentRpc zrpc.RpcClientConf
	BackendRpc    zrpc.RpcClientConf
	SettingRpc    zrpc.RpcClientConf
	BlogRpc       zrpc.RpcClientConf
	ForumRpc      zrpc.RpcClientConf
	ProductRpc    zrpc.RpcClientConf
	OrderRpc      zrpc.RpcClientConf
	PromotionRpc  zrpc.RpcClientConf
	UserRpc       zrpc.RpcClientConf

	KqDistributePointsConf struct {
		Brokers []string
		Topic   string
	}

	KqCreateGorseItemConf struct {
		Brokers []string
		Topic   string
	}

	//todo
	KqUnFreezePointCouponConf struct {
		Brokers []string
		Topic   string
	}
}
